package main

import (
	"fmt"
)

func testDefer5() {
	fmt.Println("[func testDefer5]")
	i := 1
	defer fmt.Println(i)
	i += 1
	return
}

func testDefer6() {
	fmt.Println("[func testDefer6]")
	for i := 0; i < 4; i++ {
		defer fmt.Println(i)
	}
}

func testDefer7() (result int) {
	defer func() {
		result *= 7
	}()
	return 6
}

func main() {
	fmt.Println("[func main] start")
	testDefer5()
	testDefer6()
	result := testDefer7()
	fmt.Println("result: ", result)
	fmt.Println("[func main] end")
}
